#include "velhaplayer.h"

VelhaPlayer::VelhaPlayer()
{
}

VelhaPlayer::VelhaPlayer(int valor, role role){
    this->value = valor;
    this->player_role = role;
}

void VelhaPlayer::play(int linha, int coluna, Node *node){
    if ( linha > 3 || coluna > 3 ) {
        return;
    } else{
        if ( node->board[linha][coluna] != 0 ){
            return;
        } else{
            node->board[linha][coluna] = value;
        }
    }
}

std::list<Action*> Player::generate_action_list(Node *node){
    Action *current = NULL;
    std::list<Action*> actions;
    for (int i = 0; i < node->length; i++){
        for (int j = 0 ; j < node->length; j++){
            //cout << "no board " << i <<", " << j << " - valor: " <<node->board[i][j] << endl;
            if ( node->board[i][j] == 0){
                current = new Action(i, j);
                actions.push_front(current);
            }
        }
    }
    return actions;
}

